<template>
  <div class="view-body">
    <!-- 封面 -->
    <img src="../../../assets/img/brand01.png" class="view-ac-cover" />
    <div style="background:#fff;">
      <!-- 活动名称 -->
      <div class="view-ac-name">{{base.name}}</div>
      <!-- 其他信息 -->
      <div class="view-ac-head-o">
        <div class="view-ac-team">合肥官方跑团</div>
        <div class="view-ac-share">
          <i class="el-icon-share"></i>20
        </div>
        <div class="view-ac-see">
          <i class="el-icon-view"></i> 20
        </div>
      </div>
      <!-- 报名流程 -->
      <div class="view-ac-pr-b">
        <div class="view-ac-process">
          <span>
            <el-image class="view-ac-pr-img"></el-image>
          </span>
          <span>
            <el-image class="view-ac-pr-line"></el-image>
          </span>
          <span>
            <el-image class="view-ac-pr-img"></el-image>
          </span>
          <span>
            <el-image class="view-ac-pr-line"></el-image>
          </span>
          <span>
            <el-image class="view-ac-pr-img"></el-image>
          </span>
        </div>
        <div class="view-ac-process">
          <span>
            <div class="view-ac-pr-name">报名开始</div>
            {{base.enter_time[0]}}
          </span>
          <span></span>
          <span>
            <div class="view-ac-pr-name">报名截止</div>
            {{base.enter_time[1]}}
          </span>
          <span></span>
          <span>
            <div class="view-ac-pr-name">活动开始</div>
            {{base.active_time[0]}}
          </span>
        </div>
      </div>
      <!-- 报名人 -->
      <div class="view-ac-user">
        <span>暂无人报名参加</span>
        <i class="el-icon-arrow-right"></i>
      </div>
      <!-- 标题 -->
      <div class="view-ac-title">基本信息</div>
      <!-- 进本信息 -->
      <div class="view-form">
        <div class="view-form-item">
          <div class="view-for-label">比赛时间：</div>
          <div class="view-for-body">{{base.active_time[0]}} 至 {{base.active_time[1]}}</div>
        </div>
        <div class="view-form-item">
          <div class="view-for-label">比赛地址：</div>
          <div class="view-for-body">{{base.address}}</div>
        </div>
        <div class="view-form-item">
          <div class="view-for-label">报名范围：</div>
          <div class="view-for-body">{{getAcLimit(base.active_limit)}}</div>
        </div>
        <!-- <div class="view-form-item">
          <div class="view-for-label">人数限制：</div>
          <div class="view-for-body">10/不限制</div>
        </div>-->
      </div>
      <!-- tab -->
      <div class="view-tab">
        <div
          v-for="(item,key) in tabs"
          :key="key"
          :class="tab_index == key ? 'active' : ''"
          @click="changeTab(key)"
        >{{item}}</div>
        <div
          class="view-tab-line"
          :style="'left: calc('+((33.3 / 2) +( tab_index * 33.3)) +'% - '+15+'px)'"
        ></div>
      </div>
    </div>
    <!-- 详情 -->
    <div v-if="tab_index == 0" style="padding:10px 0;" class="view-detail-box">
      <!-- <div v-html="detail"></div> -->
    </div>
    <!-- 相册 -->
    <div class="view-album" v-if="tab_index == 1">
      <div style="height:30px;"></div>
      <img src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/empty-album.jpg" class="empty-album" />
    </div>
    <!-- 评论 -->
    <div class="view-evals" v-if="tab_index == 2">
      <div class="eval-input-box">
        <el-avatar
          size="small"
          src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"
          style="float:left"
        ></el-avatar>
        <el-input placeholder="请输入内容" prefix-icon="el-icon-search" class="evals-input" size="mini"></el-input>
      </div>
      <img
        src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/empty-album.jpg"
        class="empty-album"
        size="mini"
      />
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tabs: ["详情", "相册", "评论"],
      tab_index: 0,
      base:{
        name:'春日聚会',
        enter_time:['2020-02-06','2020-03-05'],
        active_time:['2020-03-08','2020-03-18'],
        active_limit:'-1',
        address:'安徽省合肥市'
      }
    };
  },
  mounted() {
  },
  methods: {
    changeTab(key) {
      this.tab_index = key;
    },
    getAcLimit(param) {
      if (param == -1) {
        return "所有人";
      }
      if (param == 0) {
        return "跑团成员";
      }
      if (param == 1) {
        return "高级会员";
      }
    },
    //时间戳转时间
    formatTime(timestamp) {
      var date = new Date(Number(timestamp));
      var year = date.getFullYear();
      var month = date.getMonth() + 1;
      var day = date.getDate();
      var hour = date.getHours();
      var minute = date.getMinutes();
      var second = date.getSeconds();
      if(month < 10){
          month = '0' + month;
      }
      if(day < 10) {
          day = '0' + day;
      }
      return year +'-'+ month +'-'+day;
    }
  }
};
</script>

<style>
.evals-input {
  float: left;
  width: calc(100% - 40px);
  margin-left: 10px;
}
.eval-input-box {
  overflow: hidden;
  margin-top: 10px;
}
.empty-album {
  width: 100px;
  display: block;
  margin: auto;
}
.view-body {
  background: #fdfdfd;
}
.view-ac-cover {
  display: block;
  width: 100%;
  border-radius: 5px;
}
.view-ac-name {
  font-size: 16px;
  font-weight: bold;
  margin-top: 10px;
}
.view-ac-head-o {
  overflow: hidden;
  margin-top: 10px;
  border-bottom: 1px solid #e1e1e1;
  padding-bottom: 10px;
}
.view-ac-team {
  float: left;
}
.view-ac-share,
.view-ac-see {
  float: right;
}
.view-ac-see {
  margin-right: 10px;
}
.view-ac-process {
  text-align: center;
}
.view-ac-process > span {
  display: inline-block;
  width: 20%;
  font-size: 12px;
}
/* .view-ac-process > span:first-child{text-align: right}
.view-ac-process > span:last-child{text-align: left} */
.view-ac-pr-img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  vertical-align: middle;
}
.view-ac-pr-line {
  width: 40px;
  height: 20px;
  vertical-align: middle;
}
.view-ac-pr-name {
  font-weight: bold;
  margin: 5px 0;
}
.view-ac-pr-b {
  padding-top: 10px;
}
.view-ac-user {
  overflow: hidden;
}
.view-ac-user {
  height: 40px;
  line-height: 40px;
  border-top: 10px solid #fdfdfd;
  margin-top: 10px;
}
.view-ac-user i {
  float: right;
  line-height: 40px;
}
.view-ac-title {
  height: 40px;
  line-height: 40px;
  background: #fdfdfd;
  margin-top: 10px;
  padding-left: 10px;
}
.view-form-item {
  height: 40px;
  line-height: 40px;
  font-size: 12px;
  overflow: hidden;
}
.view-form-item > div {
  float: left;
}
.view-for-label {
  width: 60px;
}
.view-for-body {
  width: calc(100% - 60px);
  overflow: hidden;
}
.view-form {
  border-bottom: 10px solid #fdfdfd;
}
.view-tab {
  overflow: hidden;
  position: relative;
}
.view-tab > div {
  width: 33.3%;
  height: 40px;
  line-height: 40px;
  text-align: center;
  float: left;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
}
.view-tab .active {
  color: #8738d1;
}
.view-tab > div.view-tab-line {
  position: absolute;
  bottom: 0;
  left: calc(16.6% - 15px);
  width: 30px;
  height: 4px;
  background: #8738d1;
}
.view-detail-box img{
    display: block;
    max-width: 100%;
}
</style>